﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using FileSystem.Models;

namespace FileSystem.Services.IServices {
    /// <summary>
    /// 系统接口
    /// </summary>
    public interface ISystem {
        /// <summary>
        /// 获取当前用户
        /// </summary>
        Task<User> GetCurrentUser();

        /// <summary>
        /// 获取当前路径
        /// </summary>
        Task<string> GetCurrentLocation();

        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="userType">用户类型</param>
        /// <param name="image">图片</param>
        /// <param name="description">描述</param>
        Task CreateUser(string userName, string password,
            UserConst.UserType userType, string image, string description);

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        Task<bool> Login(string userName, string password);

        /// <summary>
        /// 登出
        /// </summary>
        Task Logout();

        /// <summary>
        /// 格式化(需要先判断当前用户有无权限)
        /// </summary>
        Task Format();

        /// <summary>
        /// 创建文件夹或纸张
        /// </summary>
        /// <param name="dirItemName">目录项名称</param>
        /// <param name="dirItemType">目录项类型</param>
        /// <param name="size">目录项大小</param>
        Task<bool> Create(string dirItemName, DirItemConst.Type dirItemType,
            int size);

        /// <summary>
        /// 为单个用户创建文件夹或纸张
        /// </summary>
        /// <param name="dirItemName">目录项名称</param>
        /// <param name="dirItemType">目录项类型</param>
        /// <param name="size">目录项大小</param>
        /// <param name="location">路径</param>
        Task CreateForUser(string dirItemName, DirItemConst.Type dirItemType,
            int size, string location);

        /// <summary>
        /// 打开目录项
        /// </summary>
        Task<IList<DirItem>> Open(string dirItemName,DirItemConst.Type dirItemType, string location);

        /// <summary>
        /// 关闭目录项
        /// </summary>
        Task<IList<DirItem>> Close(string location);

        /// <summary>
        /// 读目录项
        /// </summary>
        /// <param name="dirItemName">目录项名称</param>
        /// <param name="location">路径</param>
        /// <param name="dataSize">目录项大小</param>
        Task<string> Read(string dirItemName, string location, int dataSize);

        /// <summary>
        /// 写目录项
        /// </summary>
        /// <param name="dirItemName">目录项名称</param>
        /// <param name="location">路径</param>
        /// <param name="content">内容</param>
        /// <param name="dataSize">目录项大小</param>
        Task<bool> Write(string dirItemName, string location, string content,
            int dataSize);

        /// <summary>
        /// 删除目录项
        /// </summary>
        /// <param name="dirItemName">目录项名称</param>
        /// <param name="location">路径</param>
        Task<bool> Delete(string dirItemName, string location);

        /// <summary>
        /// 为单个用户删除目录项
        /// </summary>
        /// <param name="dirItemName">目录项名称</param>
        /// <param name="location">路径</param>
        /// <param name="dirItemType">目录项类型</param>
        Task DeleteForUser(string dirItemName, string location,
            DirItemConst.Type dirItemType);
    }
}